<template>
	<view class="profile-info d-flex ai-center" @tap="toUserSpace">
		<image class="userpic" :src="user.avatar" lazy-load></image>
		<view class="flex-1">
			<view class="username">
				{{user.nickname}}
			</view>
			<view class="detail">
				总访客 {{userData.visitorNum}}
			</view>
		</view>
		<view class="iconfont icon-jinru"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {},
				userData: {}
			}
		},
		methods: {
			toUserSpace() {
				this.$Router.push({
					name: 'user-space',
					params: {
						userId: this.user.id
					}
				})
			}
		},
		created() {
			this.user = this.$store.state.user
			this.userData = this.$store.state.userData
		}
	}
</script>

<style lang="scss" scoped>
	.profile-info {
		padding: 20upx 40upx;

		.userpic {
			flex-shrink: 0;
			width: 100upx;
			height: 100upx;
			border-radius: 50%;
			margin-right: 15upx;
		}

		.username {
			font-size: 32upx;
		}

		.detail {
			color: $uni-text-color-grey;
		}

		.icon-jinru {
			height: 100%;
			font-size: 40upx;
			color: $uni-text-color-grey;
		}
	}
</style>
